home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
VideoToolbox 96.06.15
/
VideoToolboxSources
/
Zoom.c
< prev
Wrap
Text File
|
1994-11-15
|
2KB
|
49 lines
/*
Zoom.c
10/17/90 dgp translated from pascal DoWZoom.p in Inside Mac VI.
10/18/90 dgp removed part of the code to make GetWindowDevice(), which I put
in GetScreenDevice.c
8/24/91 dgp Made compatible with THINK C 5.0.
12/27/91 dgp Extracted code to create TitleBarHeight.c
3/26/92 dgp Replaced use of SysEnvirons() by a call to QD8Exists().
6/3/94 dgp replaced low-memory global MBarHeight by GetMBarHeight().
6/12/94 dgp changed "theEvent" from a global to an argument "event", passed by address.
*/
#include "VideoToolbox.h"
#if UNIVERSAL_HEADERS
#include <LowMem.h>
#else
#define LMGetMBarHeight() (* (short *) 0x0BAA)
#define LMSetMBarHeight(MBarHeightValue) ((* (short *) 0x0BAA) = (MBarHeightValue))
#endif
void Zoom(WindowPtr theWindow,int zoomDir,EventRecord *event)
{
Rect r;
GDHandle dominantGDevice;
int headRoom;
GrafPtr savePort;
if(TrackBox(theWindow,event->where,zoomDir)){
GetPort(&savePort);
SetPort(theWindow);
EraseRect(&theWindow->portRect); /*recommended for cosmetic reasons*/
/* If there is the possibility of multiple gDevices, then we */
/* must check them to make sure we are zooming onto the right */
/* display device when zooming out. */
if(zoomDir==inZoomOut && QD8Exists()){
headRoom=TitleBarHeight(theWindow);
/* We must create a zoom rectangle manually in this case. */
/* Account for menu bar height as well, if on main device */
dominantGDevice=GetWindowDevice(theWindow);
if(dominantGDevice==GetMainDevice()) headRoom += LMGetMBarHeight();
r=(*dominantGDevice)->gdRect;
SetRect(&r,r.left+3,r.top+headRoom+3,r.right-3,r.bottom-3);
/* Set up the WStateData record for this window. */
(*((WStateData **)((WindowPeek)theWindow)->dataHandle))->stdState = r;
}
ZoomWindow(theWindow,zoomDir,TRUE);
SetPort(savePort);
}
}